/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ugc.cnel.manabi.bakenbeans.converters;

import com.icesoft.faces.component.selectinputtext.SelectInputText;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import org.ugc.cnel.manabi.entidades.Cliente;

/**
 *
 * @author Admin
 */
public class clienteConverter implements Converter {

    public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
        System.out.println(((SelectInputText)arg1).getSelectedItem());
        if (arg2 == null || arg2.length() == 0) {
            return null;
        }
        return new Cliente(0, "", arg2, "", "", null);
    }

public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
        System.out.println(arg2);
        if (arg2 != null) {
            return ((Cliente) arg2).getNombre();
        }
        return "";
    }
}
